package com.chapter_6;

/**
 * @Author: Timo
 * @Date: 2019/5/16 12:30
 * @Description: 读取
 */
public class ReaderThread extends Thread{
    private final Data data;

    public ReaderThread(Data data) {
        this.data = data;
    }

    @Override
    public void run() {
        try {
            while (true) {
                char[] c = data.read();
                System.out.println(Thread.currentThread().getName()+ " reads " + String.valueOf(c));
            }
        } catch (InterruptedException e) {
            e.getMessage();
        }
    }
}
